# $Id: PKGBUILD 81388 2012-12-19 13:22:34Z seblu $
# Maintainer: Sébastien Luttringer <seblu@aur.archlinux.org>
# Contributor: Lucas Hermann Negri <kkndrox@gmail.com>

pkgbase=luabitop
pkgname=(lua-bitop lua51-bitop)
pkgver=1.0.2
pkgrel=2
pkgdesc='C extension adding bitwise operations on numbers'
arch=(i686 x86_64)
url='http://bitop.luajit.org/index.html'
makedepends=('lua' 'lua51')
source=("http://bitop.luajit.org/download/LuaBitOp-$pkgver.tar.gz")
md5sums=('d0c1080fe0c844e8477279668e2d0d06')
license=('MIT')

build() {
  cp -a LuaBitOp-$pkgver LuaBitOp51-$pkgver
  msg2 'Building with lua 5.2'
  cd LuaBitOp-$pkgver
  make INCLUDES=' -I/usr/include' LUA='lua'
  msg2 'Building with lua 5.1'
  cd ../LuaBitOp51-$pkgver
  make INCLUDES=' -I/usr/include/lua5.1' LUA='lua5.1'
}

package_lua-bitop() {
  depends=('lua')
  cd LuaBitOp-$pkgver
  install -Dm 644 bit.so "$pkgdir/usr/lib/lua/5.2/bit.so"
  install -dm 755 "$pkgdir/usr/share/licenses/$pkgname"
  ln -s '../lua/COPYRIGHT' "$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT"
}

package_lua51-bitop() {
  depends=('lua51')
  conflicts=('luabitop')
  replaces=('luabitop')
  cd LuaBitOp51-$pkgver
  install -Dm 644 bit.so "$pkgdir/usr/lib/lua/5.1/bit.so"
  install -dm 755 "$pkgdir/usr/share/licenses/$pkgname"
  ln -s '../lua51/COPYRIGHT' "$pkgdir/usr/share/licenses/$pkgname/COPYRIGHT"
}

# vim:set ts=2 sw=2 et:
